/**
 * 
 */
package com.dsteiner.xelavos.client.model;

import java.beans.PropertyChangeListener;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.dsteiner.widgets.client.PropertyChangeCollection;
import com.dsteiner.widgets.client.domain.ModelObject;
import com.dsteiner.xelavos.client.domain.Job;
import com.dsteiner.xelavos.client.domain.Leisure;
import com.dsteiner.xelavos.client.domain.Product;
import com.dsteiner.xelavos.client.domain.Service;
import com.dsteiner.xelavos.client.domain.User;

public class TopNewModel {
	private PropertyChangeCollection propertyChangeSupport = new PropertyChangeCollection(
			this);

	private List<ModelObject> itemsTop;

	private List<ModelObject> itemsNew;

	private Map<String, List<ModelObject>> itemsTopMap = new HashMap<String, List<ModelObject>>();

	private Map<String, List<ModelObject>> itemsNewMap = new HashMap<String, List<ModelObject>>();

	public void addPropertyChangeListener(String propertyName,
			PropertyChangeListener listener) {
		propertyChangeSupport.registerPropertyChangeListener(propertyName,
				listener);
	}
	public List<ModelObject> getItemsNew() {
		return itemsNew;
	}
	public List<ModelObject> getItemsNew(String name) {
		return itemsNewMap.get(name);
	}
	public Map<String, List<ModelObject>> getItemsNewMap() {
		return itemsNewMap;
	}

	public List<ModelObject> getItemsTop() {
		return itemsTop;
	}

	public List<ModelObject> getItemsTop(String name) {
		return itemsTopMap.get(name);
	}
	public Map<String, List<ModelObject>> getItemsTopMap() {
		return itemsTopMap;
	}
	public void setItemsNew(List<ModelObject> itemsNew) {
		List<ModelObject> oldItemsNew = this.itemsNew;
		this.itemsNew = itemsNew;
		propertyChangeSupport.firePropertyChange("itemsNew", oldItemsNew, itemsNew);
	}

	public void setItemsNew(String name, List<ModelObject> items){
		Map<String, List<ModelObject>> itemsNewMap = new HashMap<String, List<ModelObject>>();
		itemsNewMap.putAll(this.itemsNewMap);
		itemsNewMap.put(name, items);
		setItemsNewMap(itemsNewMap);
	}

	public void setItemsNewMap(Map<String, List<ModelObject>> itemsNewMap) {
		Map<String, List<ModelObject>> oldItemsNewMap = this.itemsNewMap;
		this.itemsNewMap = itemsNewMap;
		propertyChangeSupport.firePropertyChange("itemsNewMap", oldItemsNewMap, itemsNewMap);
	}
	
	public void setItemsTop(List<ModelObject> itemsTop) {
		List<ModelObject> oldItemsTop = this.itemsTop;
		this.itemsTop = itemsTop;
		propertyChangeSupport.firePropertyChange("itemsTop", oldItemsTop, itemsTop);
	}
	public void setItemsTop(String name, List<ModelObject> items){
		Map<String, List<ModelObject>> itemsTopMap = new HashMap<String, List<ModelObject>>();
		itemsTopMap.putAll(this.itemsTopMap);
		itemsTopMap.put(name, items);
		setItemsTopMap(itemsTopMap);
	}
	public void setItemsTopMap(Map<String, List<ModelObject>> itemsTopMap) {
		Map<String, List<ModelObject>> oldItemsTopMap = this.itemsTopMap;
		this.itemsTopMap = itemsTopMap;
		propertyChangeSupport.firePropertyChange("itemsTopMap", oldItemsTopMap, itemsTopMap);
	}

}